# coding:utf-8
#下面的一个字串，其实际是一个get请求的参数组合，请将其解析由参数和值组成的字典。
#现在我们需要将这些参数按参数名ascii码排序，重新生成url参数组合。输出结果应为'BUY=true&CompanyId=&DISCOUNT=&DataConstraintType=0&ENDNAV=&ESTABDATE=6&FundType=6&ISABNORMAL=true&LevelOne=&LevelTwo=&MobileKey=4a69e1fc7d583fe671ad69c95ae6c2b7%7C%7C945235770232353&Sort=desc&SortColumn=SYL_Y&TOPICAL=&appType=ttjj&deviceid=4a69e1fc7d583fe671ad69c95ae6c2b7%7C%7C945235770232353&gToken=ceaf-236567466abfda4e2864831ea5645231&onFundCache=3&pageIndex=1&pageSize=30&plat=Android&product=EFund&version=6.3.2'
str='pageSize=30&product=EFund&DISCOUNT=&SortColumn=SYL_Y&MobileKey=4a69e1fc7d583fe671ad69c95ae6c2b7%7C%7C945235770232353&BUY=true&appType=ttjj&LevelOne=&version=6.3.2&onFundCache=3&Sort=desc&pageIndex=1&FundType=6&CompanyId=&plat=Android&TOPICAL=&ENDNAV=&LevelTwo=&ISABNORMAL=true&DataConstraintType=0&gToken=ceaf-236567466abfda4e2864831ea5645231&ESTABDATE=6&deviceid=4a69e1fc7d583fe671ad69c95ae6c2b7%7C%7C945235770232353'
from Day15 import ty as opt

def returnStrOrd():
    dict1=opt.returnStr()  #调用前一天的方法
    count=1
    url=''
    for y in sorted(dict1):
        url+=y+'='+dict1[y]
        if count < len(dict1):url+='&'  #最后一个无需添加&
        count+=1
    print(url)
if __name__ == '__main__':
    returnStrOrd()